import request from '../utils/httpRequest';
// 获取用户的购物车列表
export const getCartList = () => {
  return request.get({
    url: '/app-api/trade/cart/list',
  });
};

// 创建订单
export const createOrder = (data) => {
  return request.post({
    url: '/app-api/trade/order/create',
    data: data
  });
};

// 获取用户的地址信息
export const getAddressInfo = () => {
  return request.get({
    url: '/app-api/member/address/get',
  });
};

// 获取配送员
export const getPSYList = () => {
  return request.get({
    url: '/app-api/product/market-info/getPSYList',
  });
};

// 获取配菜员
export const getFJYList = () => {
  return request.get({
    url: '/app-api/product/market-info/getFJYList',
  });
};

// 获取即时达列表
export const getJsdList = () => {
  return request.get({
    url: '/app-api/trade/order/jsdList',
  });
};

// 获取自提点
export const getPickUpStore = () => {
  return request.get({
    url: '/app-api/trade/delivery/pick-up-store/list',
  });
};

/*
** 更新购物车商品数量
** id
** count
*/
export const updateCount = (data) => {
  return request.post({
    url: '/app-api/trade/cart/update-count',
    data
  });
};

/*
** 更新购物车商品选中
** ids(编号列表,示例值(1024,2048))
** selected(是否选中)
*/
export const updateSelected = (data) => {
  return request.post({
    url: '/app-api/trade/cart/update-selected',
    data
  });
};

// 查询用户在购物车中的商品数量
export const getCartCount = () => {
  return request.get({
    url: '/app-api/trade/cart/get-count',
  });
};

// 获取商品结算信息
export const getSettlement = (data) => {
  return request.post({
    url: '/app-api/trade/order/settlement',
    data
  });
};